<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="css/lib/bootstrap.min.css"/>
		<link rel="stylesheet" href="css/iconfont.css">
		<script src="js/lib/jquery-1.11.0.js"></script>
		<script src="js/lib/bootstrap.min.js"></script>
		<script src="https://cdn.bootcss.com/angular.js/1.6.3/angular.min.js"></script>
		<script src="js/lib/ecx.js"></script>
	</head>
	 <style>
	 	body{
			font-size:12px;
		}
		table td:nth-child(even) {
			
		}
		table tr:nth-child(2) {
			background-color:#f1f1f1;
		}
		input{
			width:280px;
		}
		#sho{
			width:300px;
			height:50px;
			background:#d9534f;
			opacity:0.8;
			border-radius:8px;
			color:#fff;
			text-align: center;
			font-size:20px;
			position: absolute;
			top:0px;
			left:550px;
			display:none;
		}
		#tt a{
			width:150px;
			height:50px;
			display:block;
			background:rgba(0,0,0,0.8);
			text-align:center;
			line-height:50px;
			float:left;
			margin-left:20px;
			font-size:20px;
			color:#fff;
			visibility:
		}
	 </style>
	<body ng-app="myApp" ng-controller="customersCtrl">
		<div class="">
			<div id="sho"></div>
		    <!--更新用户账户信息-->
			<div style="padding:15px 5px 0px 5px;border:3px solid #ccc;margin-bottom:15px">
			<table class="table table-hover">
				
				<tbody id="datatable">
					<tr>
						<td id="tt" colspan="13">
							<a href="全平台交易信息.html">全部</a>
							<a href="全平台交易信息-充值.html">充值</a>
							<a href="全平台交易信息-提现.html">提现</a>
							<a href="全平台交易信息-待结算.html">待结算</a>
							<a href="全平台交易信息-支付.html">支付</a>
						</td>
					</tr>
					<tr id="tr-2">
						<td colspan="14">
						<!--交易时间查询-->交易明细联合查询：
						 	<i class="iconfont icon-rili1" style="font-size:14px;display:inline-block;"></i>  <input id="d1" type="date" ng-model="star" class="form-control" style="width:150px;display:inline-block" placeholder="开始时间"> — <i style="font-size:14px;" class="iconfont icon-rili1"></i>
							<input id="d2" type="date" ng-model="end" class="form-control" style="width:150px;display:inline-block">
							 		<!-- <button ng-click="date()" id="date" class="btn btn-default" style="margin-left:20px;">查询</button> -->
							<input class="form-control" style="width:150px;display:inline-block;margin-left:20px;" type="text" name="" id="" ng-model="ph" value="" placeholder="手机号" /><!-- <button ng-click="shouji()" class="btn btn-default" style="margin-left:2px;">查询</button> --><span id="error" style="color:red"></span>
							<input class="form-control" style="width:200px;display:inline-block"  type="text" id="dingdan" ng-model="ddan" placeholder="订单号查询">
							 <select name="" id="sel1" v-on:change="xuan()" class="form-control" style="width:80px;display:inline-block">
                                <option value="">类型</option>
                                <option value="0">充值</option>
                                <option value="1">支付</option>
                                <option value="2">提现</option>
                                <option value="3">退单</option>
                            </select>
                             <select name="" id="sel2" v-on:change="xuan()" class="form-control" style="width:80px;display:inline-block">
                                <option value=""> 状态</option>
                                <option value="0">待完成</option>
                                <option value="1">已成功</option>
                                <option value="2">已取消</option>
                                <option value="3">未提交</option>
                                <option value="4">待结算</option>
                            </select>
							<!-- <button class="btn btn-danger" style="width:60px;margin-left:100px;" type="button" ng-click="dd()">查询<button> -->
							<button class="btn btn-danger" type="button" ng-click="dd()"><i class="iconfont icon-sousuo"></i>查询</button>
						</td>
					</tr>
					<tr>
                        <td colspan="15" style="color:#666;font-size:20px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>充值{{pages}}(笔)</span>&nbsp;总计：<span style="color:#f00;width:220px;display:inline-block;text-align:left">{{max}}元</span>&nbsp;&nbsp;&nbsp;&nbsp;<span>提现{{pages}}(笔)</span>总计：<span style="color:#f00;width:220px;display:inline-block;text-align:left">{{max01}}元</span></td>
                    </tr>
					<tr style="font-size:15px;background:rgb(0, 122, 255);color:#fff">
						<td style="width:55px;" class="text-center">序号</td>
						<td class="text-left">交易日期</td>
						<td class="text-left">手机号</td>
						<td class="text-left">通道</td>
						<td class="text-left">品牌</td>
						<td class="text-left">刷卡费率</td>
						<td class="text-left">出款卡</td>
						<td class="text-left">总金额</td>
						<td class="text-left">实际金额</td>
						<td class="text-left">订单号</td>
						<!-- <td class="text-left">备注信息</td> -->
						<td class="text-left">描述</td>
						<td class="text-left">类型</td>
						<td class="text-left">状态</td>
					</tr>
					<tr id="show" ng-repeat="item in items">
						<td class="text-left">{{$index+1}}</td>
						<td class="text-left">{{item.createTime | date:'yyyy-MM-dd HH:mm:ss'}}</td>
						<td class="text-left">{{item.phone}}</td>
						<td class="text-left">{{item.channelname}}</td>
						<td class="text-left">{{item.brandname}}</td>
						<td class="text-left">{{item.rate}}</td>
						<td class="text-left">{{item.bankcard}}</td>
						<td class="text-left">{{item.amount | currency:"￥ "}}</td>
						<td class="text-left">{{item.realAmount | currency:"￥ "}}</td>
						<td class="text-left">{{item.ordercode}}</td>												
						<!-- <td class="text-left">{{item.remark}}</td> -->
						<td class="text-left">{{item.desc}}</td>
						<td class="text-left">{{item.type | modify:item.type}}</td>
						<td class="text-left">
						<img ng-if="item.status==1" style="width:20px;height:20px;" src="images/成功.png" alt="" />
						<img ng-if="item.status==4" style="width:20px;height:20px;" src="images/待结算金额.png" alt="" />
						<img ng-if="item.status==0" style="width:20px;height:20px;" src="images/待完成.png" alt="" />
						<!-- <img ng-if="item.status==1" style="width:20px;height:20px;" src="images/失败.png" alt="" /> -->
						<img ng-if="item.status==2" style="width:20px;height:20px;" src="images/待处理.png" alt="" />
						{{item.status | modify2:item.status}}
						</td>
					</tr>
					<tr>
						<td colspan="14" ng-show="items.length==0" style="text-align:center;color:#ccc">---------------------------暂无数据--------------------------</td>
					</tr>
					<tr>
						<td colspan="13" id="show01" class="text-center">
							第<input class="form-control" id="ye" ng-init="ye=1" ng-model="ye" style="width:50px;display:inline-block" type="text"/>页
							<button class="btn btn-default" ng-click="xia()">跳转</button>总共{{pages}}条数据    当前一共{{page}}页
							<button class="btn btn-default" ng-click="home()">首页</button>
							<button class="btn btn-default" ng-click="sh()">上一页</button>
							<button class="btn btn-default" ng-click="next()">下一页</button>
							<button class="btn btn-default" ng-click="last(page)">尾页</button>
						</td>
					</tr>
					<tr>
						<td colspan="14">								
<a class="btn btn-success" download="交易数据报表.xls" href="#" onclick="return ExcellentExport.excel(this, 'datatable', 'Sheet Name Here');">Excel表格下载</a>
						</td>
					</tr>
				</tbody>
			</table>		
		</div>
		</div>
	</body>
	<script>
		$(function(){		
		})
	</script>
	<script>
		var app = angular.module('myApp', []);
	   /*自定义过滤器   1*/
		app.filter("modify",function(){
			return function(input,param){
				if(param == 0){
					return param = "💳充值"
				}
				if(param == 1){
					return param = "💵支付"
				}
				if(param == 2){
					return param = "💰提现"
				}
				if(param == 3){
					return param = "退单"
				}
				input = param
				return input
			}
		})
		/*自定义过滤器   2*/
		app.filter("modify2",function(){
			return function(input,param){
				if(param == 0){
					return param = "待完成"
				}
				if(param == 1){
					return param = "已成功"
				}
				if(param == 2){
					return param = "已取消"
				}
				if(param == 3){
					return param = "待处理"
				}
				if(param == 4){
					return param = "待结算"
				}
				input = param
				return input
			}
		})
		/*过滤器*/
		
        app.controller('customersCtrl', function($scope, $http ){
        	/*根据登陆信息获取token*/
        	var token = sessionStorage.getItem(key=1);
        	var brandid = sessionStorage.getItem(key = 3);
        	
        	console.log(brandid)
        	/*直接或分页查询交易明细*/
				$http({
					method:'POST',
					params:{size:20,page:0,brand_id:brandid},					
					url: window.baseUrl+"transactionclear/payment/query/all"					
				}).then(function successCallback(data){
					console.log("直接或分页查询交易明细成功...")
					console.log(data.data)
					$scope.items = data.data.result.content;
					$scope.pages = data.data.result.totalElements;
					$scope.page  = data.data.result.totalPages;
					/*var sum = document.getElementById('datatable');
        			alert(sum.rows[20].cells[1].innerHTML)*/
					/*$scope.size = */
				}, function errorCallback(data) {
						console.log("直接或分页查询交易明细失败...")
				     	console.log(data)
				});
				$scope.xia = function(){
					var ye = document.getElementById("ye").value-1;
					var brandid = sessionStorage.getItem(key = 3);
					$http({
					method:'POST',
					params:{size:20,page:ye,brand_id:brandid},					
					url: window.baseUrl+"transactionclear/payment/query/all"					
					}).then(function successCallback(data){
						console.log("直接或分页查询交易明细成功...")
						console.log(data.data)
						$scope.items = data.data.result.content
						$scope.pages = data.data.result.totalElements
						$scope.page  = data.data.result.totalPages
					}, function errorCallback(data) {
							console.log("直接或分页查询交易明细失败...")
					     	console.log(data)
					});
				}
				/*回到首页*/
				$scope.home = function(){
					$scope.ye = 1;
					var brandid = sessionStorage.getItem(key = 3)
                    $http({
                        method:'POST',
                        params:{size:20,page:$scope.ye-1,brand_id:brandid},
                        url: window.baseUrl+"transactionclear/payment/query/all"
                    }).then(function successCallback(data){
                        console.log("直接或分页查询交易明细成功...")
                        console.log(data.data)
                        $scope.items = data.data.result.content
                        $scope.pages = data.data.result.totalElements
                        $scope.page  = data.data.result.totalPages
                    }, function errorCallback(data) {
                        console.log("直接或分页查询交易明细失败...")
                        console.log(data)
                    });
				}
				/*到达最后一页*/
				$scope.last = function(page){
				    console.log(page);
				    var brandid = sessionStorage.getItem(key = 3)
                    $http({
                        method:'POST',
                        params:{size:20,page:page-1,brand_id:brandid},
                        url: window.baseUrl+"transactionclear/payment/query/all"
                    }).then(function successCallback(data){
                        console.log("直接或分页查询交易明细成功...")
                        console.log(data.data)
                        $scope.items = data.data.result.content
                        $scope.pages = data.data.result.totalElements
                        $scope.page  = data.data.result.totalPages
                    }, function errorCallback(data) {
                        console.log("直接或分页查询交易明细失败...")
                        console.log(data)
                    });
                    $scope.ye = page
				}
				$scope.next = function(){
				   var ye =  $scope.ye+=1;
				   var brandid = sessionStorage.getItem(key = 3)
				   console.log(ye-1)
                    $http({
                        method:'POST',
                        params:{size:20,page:ye-1,brand_id:brandid},
                        url: window.baseUrl+"transactionclear/payment/query/all"
                    }).then(function successCallback(data){
                        console.log("直接或分页查询交易明细成功...")
                        console.log(data.data)
                        $scope.items = data.data.result.content
                        $scope.pages = data.data.result.totalElements
                        $scope.page  = data.data.result.totalPages
                    }, function errorCallback(data) {
                        console.log("直接或分页查询交易明细失败...")
                        console.log(data)
                    });
				}
				$scope.sh = function(){
				    var ye = $scope.ye-=1;
				    var brandid = sessionStorage.getItem(key = 3)
				    ye = ye-1;
				    console.log(ye);
				    if(ye <= 0){
				        $scope.ye = 1;
				        console.log(ye)
					}
                    $http({
                        method:'POST',
                        params:{size:20,page:ye,brand_id:brandid},
                        url: window.baseUrl+"transactionclear/payment/query/all"
                    }).then(function successCallback(data){
                        console.log("直接或分页查询交易明细成功...")
                        console.log(data.data)
                        $scope.items = data.data.result.content
                        $scope.pages = data.data.result.totalElements
                        $scope.page  = data.data.result.totalPages
                    }, function errorCallback(data) {
                        console.log("直接或分页查询交易明细失败...")
                        console.log(data)
                    });
				}
				$scope.date = function(){
					var d1 = document.getElementById('d1').value;//获取开始时间
					var d_1 = document.getElementById('d2').value;
					d_1 = d_1.substr(0,9)
					console.log(d_1)
		        	var d_2 = parseInt(document.getElementById('d2').value.substr(9,10))+1;
		        	console.log(d_2)
		        	var d2 = d_1+d_2;//获取结束时间
		        	var brandid = sessionStorage.getItem(key = 3);
		        	var oSel1=document.getElementById('sel1');
		        	var sel1 = oSel1.options[oSel1.selectedIndex].value;
		        	var oSel2=document.getElementById('sel2');
		        	var sel2 = oSel2.options[oSel2.selectedIndex].value;
		   			/*var d1 = $scope.star;
		   			var d2 = $scope.end;*/
		        	console.log(d1,d2);
		        	var data = {						
						start_time:d1,
						end_time:d2,
						phone:$scope.ph,
						brand_id:brandid,
						size:1000,
						type:sel1/*,
						status:sel2*/
					};
					console.log(data)
						$http({
                        method:'POST',
                        params:data,
                        url: window.baseUrl+"transactionclear/payment/query/all"
                    }).then(function successCallback(data){
                        console.log("直接或分页查询交易明细成功...")
                        console.log(data.data)
                        $scope.items = data.data.result.content
                        $scope.pages = data.data.result.totalElements
                        $scope.page  = data.data.result.totalPages
                    }, function errorCallback(data) {
                        console.log("直接或分页查询交易明细失败...")
                        console.log(data)
                    });
				}
				/*查询*/
				$scope.dd = function(){
					var d1 = document.getElementById('d1').value;//获取开始时间
					var d_1 = document.getElementById('d2').value;
					d_1 = d_1.substr(0,9)
					console.log(d_1)
		        	var d_2 = parseInt(document.getElementById('d2').value.substr(9,10))+1;
		        	console.log(d_2)
		        	var d2 = d_1+d_2;//获取结束时间
		        	var brandid = sessionStorage.getItem(key = 3)
		   			/*var d1 = $scope.star;
		   			var d2 = $scope.end;*/
		        	console.log(d1,d2);
		        	var oSel1=document.getElementById('sel1');
		        	var oSel2=document.getElementById('sel2');
		        	var sel1 = oSel1.options[oSel1.selectedIndex].value;//获取审核状态参数
                    var sel2 = oSel2.options[oSel2.selectedIndex].value;
                    console.log(sel1);
					var data = {
						phone:$scope.ph,
						order_code:$scope.ddan,
						start_time:d1,
						end_time:d2,
						brand_id:brandid,
						size:100000,
						type:sel1,
						status:sel2
					};
					console.log(data)
						$http({
                        method:'POST',
                        params:data,
                        url: window.baseUrl+"transactionclear/payment/query/all"
                    }).then(function successCallback(data){
                        console.log("直接或分页查询交易明细成功...")
                        console.log(data.data)
                        $scope.items = data.data.result.content
                        $scope.pages = data.data.result.totalElements
                        $scope.page  = data.data.result.totalPages
                        $scope.max = data.data.result.recharged
                        $scope.max01 = data.data.result.withdrawed
                    }, function errorCallback(data) {
                        console.log("直接或分页查询交易明细失败...")
                        console.log(data)
                    });
				}
        })
	</script>
	<script>
		$(function(){
			var cf = $('.text-center').html();
			console.log(cf)
		})
	</script>
</html>

